<%@page import="java.util.ArrayList"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page
	import="com.tofindaway.entity.Article,
	com.tofindaway.service.UserServ,
	org.springframework.web.context.WebApplicationContext,
	org.springframework.web.context.ContextLoader,
	java.util.List,java.util.ArrayList"%>
<%
	WebApplicationContext context = ContextLoader
			.getCurrentWebApplicationContext();
	UserServ userServ = (UserServ) context.getBean("userServ");
	List<Article> articles = new ArrayList<Article>();
	try {
		articles = userServ.getArticles();
	} catch (Exception e) {
		out.println("<strong>服务器出现异常。请稍后再试。</strong>");
	}
%>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/blog/css/main.css" />
<title>愿生如夏花之绚烂 2012</title>
</head>
<body>
	<%@ include file="/include/nav.jsp" %>

	<div style="height: 50px;"></div>
	<%
		for (Article article : articles) {
	%>
	<div class="article">
		<div class="title">
			<a href="./articles/thread-00<%out.print(article.getId());%>.html">
				<%
					out.print(article.getTitle());
				%>
			</a>
		</div>
		<div class="time">
			<ul>
				<li>作者:<%
					out.print(article.getUser().getNickname());
				%></li>
				<li>发表时间:<%
					out.println(article.getCreated());
				%></li>
			</ul>
		</div>
		<div class="content">
			<%
				out.println(article.getContent());
			%>
		</div>
		<div class="tags">
			<a href="#">tags:<%
				out.println(article.getTag());
			%></a><span><a href="#"> ✪ <%
				out.print(article.getReplaySet().size());
			%> comments
			</a></span>
		</div>
	</div>
	<%
		}
	%>
</body>
</html>